<template>
	<view class="content">
		<view style="height: 30rpx"></view>
		<!-- <view class="qiYe" @click="toQiYeDetails">
      <view v-if="company.company">
        <view class="title">{{ company.company.name }}</view>
        <view class="name">{{ company.charger_name }}</view>
      </view>
      <view v-if="company.company">
        <image :src="pic + company.company.logo" mode="scaleToFill" />
      </view>
    </view>
    <view class="titles">
      <view class="left"></view>
      <view class="name">在招职位</view>
    </view> -->
		<view class="items" v-for="item in list.data" :key="item.id" @click="editdetail(item.id)">
			<view class="lie">
				<view class="max-text">{{ item.name }}</view>
				<view class="min-text">{{item.address}}</view>
			</view>
			<view class="lie">
				<view class="text-color" style="font-size: 28rpx; font-weight: 600">{{
          item.xname
        }}</view>
			</view>
			<view class="flex">
				<view v-for="(items, index) in item.fulilabels" :key="index">
					<y-tag v-if="index < 4" :text="items.name" bgcolors="#efefef" color="#000000"></y-tag>
				</view>
				<view v-if="item.fulilabels.length > 4">...</view>
			</view>
			<view class="flexright margin_top" @click.stop="listid=item.id;modal.modalShow=true;">
				<u-icon name="trash" color="#c1282e" size="24"></u-icon>
				<view class="xiaohong" style="color: #c1282e;">删除</view>
			</view>
		</view>
		<moDal :message="modal" @modalSure="modalSure" @modalcancel="modalcancel"></moDal>
	</view>
</template>

<script>
	import yTag from "@/components/y-tag/index";
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		components: {
		  yTag,
		},
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				modal:{
					modalShow:false,
					title:"是否确认删除当前内容？",
				},
				listid:"",
			};
		},
		onShow() {
			this.init();
		},
		methods: {
			modalSure(){
				if(this.modal.title=="是否确认删除当前内容？"){
					let url = '/api/recruit/delrecruit'
					httpRequest.request(url, 'GET', {
						id:this.listid
					}, false, false, true).then(res => {
						httpRequest.toast(res.msg)
						if (res.code == 1) {
							this.init()
						}
					})
				}
				this.modalcancel()
			},
			modalcancel(){
				this.modal.modalShow = false
			},
			editdetail(id){
				uni.navigateTo({
					url:"/pages/tab4/recruit?id="+id
				})
			},
			init(isPage, page) {
				uni.showLoading({
					mask: true,
					title: "请稍后"
				})
				let _this = this;
				let data = {
					page: page || 1,
					limit: _this.limit,
				}
				let url = '/api/recruit/myrecruit'
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = resList
							_this.list.data = resList.data;
						}
						this.$forceUpdate()
					}
					uni.hideLoading()
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		},
	};
</script>
<style lang="scss" scoped>
	.items {
		padding: 20rpx;
		background: #fff;
		opacity: 1;
		margin: 0rpx 30rpx 30rpx;
		border-radius: 10rpx;
		align-items: center;

		.lie {
			display: flex;
			justify-content: space-between;
			margin-bottom: 20rpx;

			.sex {
				font-size: 24rpx;
			}
		}
	}

	.qiYe {
		padding: 20rpx;
		display: flex;
		border-radius: 20rpx;
		justify-content: space-between;
		background-image: linear-gradient(to right, #87aef6, #6190f7);
		margin: 0 25rpx;
		align-items: center;
		color: white;

		image {
			width: 150rpx;
			height: 150rpx;
		}

		.title {
			font-size: 32rpx;
			margin-bottom: 20rpx;
		}

		.name {
			font-size: 24rpx;
		}
	}

	.titles {
		display: flex;
		padding-bottom: 40rpx;
		padding-top: 40rpx;

		.left {
			width: 16rpx;
			background-color: #4777f6;
			border-radius: 50rpx;
			margin: 0 20rpx;
		}

		.name {
			font-weight: 800;
		}
	}
</style>